package cn.wolfcode.web.interceptor;

import org.springframework.web.servlet.HandlerInterceptor;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

public class Logininterceptor  implements HandlerInterceptor {



    @Override
    public boolean preHandle(HttpServletRequest request, HttpServletResponse response, Object handler) throws Exception {
        Object usersession = request.getSession().getAttribute("USERSESSION");
        if (usersession!=null) {
            return true;
        }
        response.sendRedirect("/login.html");
        return false;
    }
}
